<?php


namespace App\Http\observer;


use App\Jobs\EggLogQrcodeJob;
use App\Models\EggLog;
use App\Models\Image;

class EggLogObserver
{
    public function created(EggLog $eggLog)
    {
        if ($eggLog->type==1){
            EggLogQrcodeJob::dispatch($eggLog);
        }
    }

    public function updated(EggLog $eggLog)
    {
        if ($eggLog["state"]==1){
                Image::del_data($eggLog["qrcode"]);
        }
    }
}
